﻿@{
    ViewBag.Title = "我的预约";
}
@model List<zqdn.Web.ViewModels.MyAppointViewModel>
<div class="wrap doctor-operation-page">
    <div class="doctor-appoint-page common-list">
        @if (Model.Count == 0)
        {
            <p style='text-align:center;margin-top:10px;'>暂无信息！</p>
        }
        @foreach (var item in Model)
        {
            @*@Html.Hidden("vid", (int)item.ID)*@

    <div class="list-data" data-status="@item.Status" vid="@item.ID">
        <ul>
            <li class="items" id="left">
                <div>
                    <img class="list-left-img" src="~/content/images/appoint-icon.png" alt="我的预约">
                </div>
            </li>
            <li class="items" id="center">
                <div class="nocenter">
                    <p class="title">@item.OperationName</p>
                    <p class="user-message">
                        <span class="m1"></span>
                        <span class="m3">@item.HosName</span>
                    </p>
                    <p class="view-message">
                        <span class="m1"></span>
                        <span class="m3">@item.TimeGap.ToShortDateString()</span>
                    </p>
                </div>
            </li>
            @if (item.Status == 0)
            {
                <li class="items right">
                    <img class="list-left-img appointedit" inviteid="@item.ID" src="~/content/images/appoint-success-icon.png" alt="同意该场手术" style="margin-top: 26px;">
                </li>
            }
            else
            {
                <li class="items" id="right"></li>
            }

            @*<li class="items">
                    @if (item.Status == 0)
                    {
                        <a href="#" class="appointedit" style="margin-top:34px;display:inline-block;" inviteid="@item.ID"><i class="fa fa-pencil icon-large"></i>同意该场手术</a>
                    }
                    else
                    {
                        <a href="@Url.Action("AppointApply", "HosCenter", new { id=item.CaseID,source=1})" class="viewcase" style="margin-top:34px;display:inline-block;"><i class="fa fa-pencil icon-large"></i>查看患者病例</a>
                    }
                </li>*@
        </ul>
    </div>
        }
        
    </div>
</div>

@section scripts
{
    <script type="text/javascript">
        $(function () {
            $(".appointedit").on("click", function () {
                var _inviteid = $(this).attr("inviteid");
                layer.open({
                    content: "确认同意该场手术吗？",
                    btn: ['确认', '取消'],
                    shadeClose: false,
                    yes: function () {
                        $.post("/DocCenter/MyAppoint/", { "inviteid": _inviteid}, function (data) {
                            var result = "";
                            if (data == 1) {
                                result="预约处理成功！"
                            } else {
                                result = "处理失败，请稍后再试！"
                            }
                            layer.open({
                                content: result,
                                btn: ['确定'],
                                yes: function () {
                                    location.reload();
                                }
                            })
                        });
                    }
                })
            });

            $(".list-data").on("click", function () {
                if ($(this).attr("data-status") == 1) {
                location.href = "/HosCenter/AppointApply/?id=" + $(this).attr("vid") + "&source=1";
               }
            });
        });
    </script>
}

